import Vue from 'vue'
Vue.filter('date', function (now, methods) {
  var date = new Date(now)
  var y = date.getFullYear()
  var M = date.getMonth() + 1
  var d = date.getDate()
  var h = date.getHours() + 1
  var m = date.getMinutes()
  var format = (num) => {
    return num < 10 ? '0' + num : num
  }
  if (methods === 'short') {
    return format(M) + '-' + format(d)
  }
  return format(y) + '-' + format(M) + '-' + format(d) + ' ' + format(h) + ':' + format(m)
})

Vue.filter('articleType', function (type) {
  var typeArr = ['', '闲谈贴', '技术贴', '自述贴', '吐槽贴']
  return typeArr[type]
})